
'===============================================================================
'  Generated From - VbNet_SQL_dOOdads_BusinessEntity.vbgen
' 
'  ** IMPORTANT  **
'  How to Generate your stored procedures:
' 
'  SQL        = SQL_StoredProcs.vbgen
'  ACCESS     = Access_StoredProcs.vbgen
'  ORACLE     = Oracle_StoredProcs.vbgen
'  FIREBIRD   = FirebirdStoredProcs.vbgen
'  POSTGRESQL = PostgreSQL_StoredProcs.vbgen
'
'  The supporting base class SqlClientEntity is in the Architecture directory in "dOOdads".
'  
'  This object is 'MustInherit' which means you need to inherit from it to be able
'  to instantiate it.  This is very easilly done. You can Override properties and
'  methods in your derived class, this allows you to regenerate this class at any
'  time and not worry about overwriting custom code. 
'
'  NEVER EDIT THIS FILE.
'
'  Public Class YourObject
'    Inherits _YourObject
'
'  End Class
'
'===============================================================================

' Generated by MyGeneration Version # (1.3.0.3)

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Collections
Imports System.Collections.Specialized

Imports MyGeneration.dOOdads

NameSpace ClassSigeco

Public MustInherit Class _si_notaRemision
	Inherits SqlClientEntity

		Public Sub New() 
			Me.QuerySource = "si_notaRemision"
			Me.MappingName = "si_notaRemision"
		End Sub

	'=================================================================
	'  Public Overrides Sub AddNew()
	'=================================================================
	'
	'=================================================================
	Public Overrides Sub AddNew()
		MyBase.AddNew()
				
	End Sub
	
	Public Overrides Sub FlushData()
		Me._whereClause = nothing
		Me._aggregateClause = nothing		
		MyBase.FlushData()
	End Sub
	
		
	'=================================================================
	'  	Public Function LoadAll() As Boolean
	'=================================================================
	'  Loads all of the records in the database, and sets the currentRow to the first row
	'=================================================================
	Public Function LoadAll() As Boolean
	
		Dim parameters As ListDictionary = Nothing
		
		
    	Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_si_notaRemisionLoadAll]", parameters)
		
	End Function

	'=================================================================
	' Public Overridable Function LoadByPrimaryKey()  As Boolean
	'=================================================================
	'  Loads a single row of via the primary key
	'=================================================================
        Public Overridable Function LoadByPrimaryKey(ByVal IdNotaRemision As Integer) As Boolean

            Dim parameters As ListDictionary = New ListDictionary()
            parameters.Add(_si_notaRemision.Parameters.IdNotaRemision, IdNotaRemision)


            Return MyBase.LoadFromSql("[" + Me.SchemaStoredProcedure + "proc_si_notaRemisionLoadByPrimaryKey]", parameters)

        End Function

#Region "Parameters"
        Protected Class Parameters

            Public Shared ReadOnly Property IdNotaRemision() As SqlParameter
                Get
                    Return New SqlParameter("@IdNotaRemision", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property NroComprobante() As SqlParameter
                Get
                    Return New SqlParameter("@NroComprobante", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property Fecha() As SqlParameter
                Get
                    Return New SqlParameter("@Fecha", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdVenta() As SqlParameter
                Get
                    Return New SqlParameter("@IdVenta", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdCompra() As SqlParameter
                Get
                    Return New SqlParameter("@IdCompra", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdMotivoStock() As SqlParameter
                Get
                    Return New SqlParameter("@IdMotivoStock", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property Estado() As SqlParameter
                Get
                    Return New SqlParameter("@Estado", SqlDbType.NVarChar, 50)
                End Get
            End Property

            Public Shared ReadOnly Property ActualizadoPor() As SqlParameter
                Get
                    Return New SqlParameter("@ActualizadoPor", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property ActualizadoFecha() As SqlParameter
                Get
                    Return New SqlParameter("@ActualizadoFecha", SqlDbType.DateTime, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdCliente() As SqlParameter
                Get
                    Return New SqlParameter("@IdCliente", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdProveedor() As SqlParameter
                Get
                    Return New SqlParameter("@IdProveedor", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdDepositoOrigen() As SqlParameter
                Get
                    Return New SqlParameter("@IdDepositoOrigen", SqlDbType.Int, 0)
                End Get
            End Property

            Public Shared ReadOnly Property IdDepositoDestino() As SqlParameter
                Get
                    Return New SqlParameter("@IdDepositoDestino", SqlDbType.Int, 0)
                End Get
            End Property

        End Class
#End Region

#Region "ColumnNames"
        Public Class ColumnNames

            Public Const IdNotaRemision As String = "idNotaRemision"
            Public Const NroComprobante As String = "nroComprobante"
            Public Const Fecha As String = "fecha"
            Public Const IdVenta As String = "idVenta"
            Public Const IdCompra As String = "idCompra"
            Public Const IdMotivoStock As String = "idMotivoStock"
            Public Const Estado As String = "estado"
            Public Const ActualizadoPor As String = "actualizadoPor"
            Public Const ActualizadoFecha As String = "actualizadoFecha"
            Public Const IdCliente As String = "idCliente"
            Public Const IdProveedor As String = "idProveedor"
            Public Const IdDepositoOrigen As String = "idDepositoOrigen"
            Public Const IdDepositoDestino As String = "idDepositoDestino"

            Public Shared Function ToPropertyName(ByVal columnName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdNotaRemision) = _si_notaRemision.PropertyNames.IdNotaRemision
                    ht(NroComprobante) = _si_notaRemision.PropertyNames.NroComprobante
                    ht(Fecha) = _si_notaRemision.PropertyNames.Fecha
                    ht(IdVenta) = _si_notaRemision.PropertyNames.IdVenta
                    ht(IdCompra) = _si_notaRemision.PropertyNames.IdCompra
                    ht(IdMotivoStock) = _si_notaRemision.PropertyNames.IdMotivoStock
                    ht(Estado) = _si_notaRemision.PropertyNames.Estado
                    ht(ActualizadoPor) = _si_notaRemision.PropertyNames.ActualizadoPor
                    ht(ActualizadoFecha) = _si_notaRemision.PropertyNames.ActualizadoFecha
                    ht(IdCliente) = _si_notaRemision.PropertyNames.IdCliente
                    ht(IdProveedor) = _si_notaRemision.PropertyNames.IdProveedor
                    ht(IdDepositoOrigen) = _si_notaRemision.PropertyNames.IdDepositoOrigen
                    ht(IdDepositoDestino) = _si_notaRemision.PropertyNames.IdDepositoDestino

                End If

                Return CType(ht(columnName), String)

            End Function

            Private Shared ht As Hashtable = Nothing
        End Class
#End Region

#Region "PropertyNames"
        Public Class PropertyNames

            Public Const IdNotaRemision As String = "IdNotaRemision"
            Public Const NroComprobante As String = "NroComprobante"
            Public Const Fecha As String = "Fecha"
            Public Const IdVenta As String = "IdVenta"
            Public Const IdCompra As String = "IdCompra"
            Public Const IdMotivoStock As String = "IdMotivoStock"
            Public Const Estado As String = "Estado"
            Public Const ActualizadoPor As String = "ActualizadoPor"
            Public Const ActualizadoFecha As String = "ActualizadoFecha"
            Public Const IdCliente As String = "IdCliente"
            Public Const IdProveedor As String = "IdProveedor"
            Public Const IdDepositoOrigen As String = "IdDepositoOrigen"
            Public Const IdDepositoDestino As String = "IdDepositoDestino"

            Public Shared Function ToColumnName(ByVal propertyName As String) As String

                If ht Is Nothing Then

                    ht = New Hashtable

                    ht(IdNotaRemision) = _si_notaRemision.ColumnNames.IdNotaRemision
                    ht(NroComprobante) = _si_notaRemision.ColumnNames.NroComprobante
                    ht(Fecha) = _si_notaRemision.ColumnNames.Fecha
                    ht(IdVenta) = _si_notaRemision.ColumnNames.IdVenta
                    ht(IdCompra) = _si_notaRemision.ColumnNames.IdCompra
                    ht(IdMotivoStock) = _si_notaRemision.ColumnNames.IdMotivoStock
                    ht(Estado) = _si_notaRemision.ColumnNames.Estado
                    ht(ActualizadoPor) = _si_notaRemision.ColumnNames.ActualizadoPor
                    ht(ActualizadoFecha) = _si_notaRemision.ColumnNames.ActualizadoFecha
                    ht(IdCliente) = _si_notaRemision.ColumnNames.IdCliente
                    ht(IdProveedor) = _si_notaRemision.ColumnNames.IdProveedor
                    ht(IdDepositoOrigen) = _si_notaRemision.ColumnNames.IdDepositoOrigen
                    ht(IdDepositoDestino) = _si_notaRemision.ColumnNames.IdDepositoDestino

                End If

                Return CType(ht(propertyName), String)

            End Function

            Private Shared ht As Hashtable = Nothing

        End Class
#End Region

#Region "StringPropertyNames"
        Public Class StringPropertyNames

            Public Const IdNotaRemision As String = "s_IdNotaRemision"
            Public Const NroComprobante As String = "s_NroComprobante"
            Public Const Fecha As String = "s_Fecha"
            Public Const IdVenta As String = "s_IdVenta"
            Public Const IdCompra As String = "s_IdCompra"
            Public Const IdMotivoStock As String = "s_IdMotivoStock"
            Public Const Estado As String = "s_Estado"
            Public Const ActualizadoPor As String = "s_ActualizadoPor"
            Public Const ActualizadoFecha As String = "s_ActualizadoFecha"
            Public Const IdCliente As String = "s_IdCliente"
            Public Const IdProveedor As String = "s_IdProveedor"
            Public Const IdDepositoOrigen As String = "s_IdDepositoOrigen"
            Public Const IdDepositoDestino As String = "s_IdDepositoDestino"

        End Class
#End Region

#Region "Properties"
        Public Overridable Property IdNotaRemision() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdNotaRemision)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdNotaRemision, Value)
            End Set
        End Property

        Public Overridable Property NroComprobante() As String
            Get
                Return MyBase.Getstring(ColumnNames.NroComprobante)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.NroComprobante, Value)
            End Set
        End Property

        Public Overridable Property Fecha() As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.Fecha)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.Fecha, Value)
            End Set
        End Property

        Public Overridable Property IdVenta() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdVenta)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdVenta, Value)
            End Set
        End Property

        Public Overridable Property IdCompra() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdCompra)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdCompra, Value)
            End Set
        End Property

        Public Overridable Property IdMotivoStock() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdMotivoStock)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdMotivoStock, Value)
            End Set
        End Property

        Public Overridable Property Estado() As String
            Get
                Return MyBase.Getstring(ColumnNames.Estado)
            End Get
            Set(ByVal Value As String)
                MyBase.Setstring(ColumnNames.Estado, Value)
            End Set
        End Property

        Public Overridable Property ActualizadoPor() As Integer
            Get
                Return MyBase.Getint(ColumnNames.ActualizadoPor)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.ActualizadoPor, Value)
            End Set
        End Property

        Public Overridable Property ActualizadoFecha() As DateTime
            Get
                Return MyBase.GetDateTime(ColumnNames.ActualizadoFecha)
            End Get
            Set(ByVal Value As DateTime)
                MyBase.SetDateTime(ColumnNames.ActualizadoFecha, Value)
            End Set
        End Property

        Public Overridable Property IdCliente() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdCliente)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdCliente, Value)
            End Set
        End Property

        Public Overridable Property IdProveedor() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdProveedor)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdProveedor, Value)
            End Set
        End Property

        Public Overridable Property IdDepositoOrigen() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdDepositoOrigen)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdDepositoOrigen, Value)
            End Set
        End Property

        Public Overridable Property IdDepositoDestino() As Integer
            Get
                Return MyBase.Getint(ColumnNames.IdDepositoDestino)
            End Get
            Set(ByVal Value As Integer)
                MyBase.Setint(ColumnNames.IdDepositoDestino, Value)
            End Set
        End Property


#End Region
	
	#Region "String Properties" 

		Public Overridable Property s_IdNotaRemision As String
			Get
				If Me.IsColumnNull(ColumnNames.IdNotaRemision) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdNotaRemision)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdNotaRemision)
				Else
					Me.IdNotaRemision = MyBase.SetintAsString(ColumnNames.IdNotaRemision, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_NroComprobante As String
			Get
				If Me.IsColumnNull(ColumnNames.NroComprobante) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.NroComprobante)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.NroComprobante)
				Else
					Me.NroComprobante = MyBase.SetstringAsString(ColumnNames.NroComprobante, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Fecha As String
			Get
				If Me.IsColumnNull(ColumnNames.Fecha) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.Fecha)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Fecha)
				Else
					Me.Fecha = MyBase.SetDateTimeAsString(ColumnNames.Fecha, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdVenta As String
			Get
				If Me.IsColumnNull(ColumnNames.IdVenta) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdVenta)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdVenta)
				Else
					Me.IdVenta = MyBase.SetintAsString(ColumnNames.IdVenta, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdCompra As String
			Get
				If Me.IsColumnNull(ColumnNames.IdCompra) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdCompra)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdCompra)
				Else
					Me.IdCompra = MyBase.SetintAsString(ColumnNames.IdCompra, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdMotivoStock As String
			Get
				If Me.IsColumnNull(ColumnNames.IdMotivoStock) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdMotivoStock)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdMotivoStock)
				Else
					Me.IdMotivoStock = MyBase.SetintAsString(ColumnNames.IdMotivoStock, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_Estado As String
			Get
				If Me.IsColumnNull(ColumnNames.Estado) Then
					Return String.Empty
				Else
					Return MyBase.GetstringAsString(ColumnNames.Estado)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.Estado)
				Else
					Me.Estado = MyBase.SetstringAsString(ColumnNames.Estado, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_ActualizadoPor As String
			Get
				If Me.IsColumnNull(ColumnNames.ActualizadoPor) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.ActualizadoPor)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.ActualizadoPor)
				Else
					Me.ActualizadoPor = MyBase.SetintAsString(ColumnNames.ActualizadoPor, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_ActualizadoFecha As String
			Get
				If Me.IsColumnNull(ColumnNames.ActualizadoFecha) Then
					Return String.Empty
				Else
					Return MyBase.GetDateTimeAsString(ColumnNames.ActualizadoFecha)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.ActualizadoFecha)
				Else
					Me.ActualizadoFecha = MyBase.SetDateTimeAsString(ColumnNames.ActualizadoFecha, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdCliente As String
			Get
				If Me.IsColumnNull(ColumnNames.IdCliente) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdCliente)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdCliente)
				Else
					Me.IdCliente = MyBase.SetintAsString(ColumnNames.IdCliente, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdProveedor As String
			Get
				If Me.IsColumnNull(ColumnNames.IdProveedor) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdProveedor)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdProveedor)
				Else
					Me.IdProveedor = MyBase.SetintAsString(ColumnNames.IdProveedor, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdDepositoOrigen As String
			Get
				If Me.IsColumnNull(ColumnNames.IdDepositoOrigen) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdDepositoOrigen)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdDepositoOrigen)
				Else
					Me.IdDepositoOrigen = MyBase.SetintAsString(ColumnNames.IdDepositoOrigen, Value)
				End If
			End Set
		End Property

		Public Overridable Property s_IdDepositoDestino As String
			Get
				If Me.IsColumnNull(ColumnNames.IdDepositoDestino) Then
					Return String.Empty
				Else
					Return MyBase.GetintAsString(ColumnNames.IdDepositoDestino)
				End If
			End Get
			Set(ByVal Value As String)
				If String.Empty = value Then
					Me.SetColumnNull(ColumnNames.IdDepositoDestino)
				Else
					Me.IdDepositoDestino = MyBase.SetintAsString(ColumnNames.IdDepositoDestino, Value)
				End If
			End Set
		End Property


	#End Region  	

	#Region "Where Clause"
    Public Class WhereClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffWhereParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffWhereParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "TearOff's"
		Public class TearOffWhereParameter

			Public Sub New(ByVal clause As WhereClause)
				Me._clause = clause
			End Sub
		
	
			Public ReadOnly Property IdNotaRemision() As WhereParameter
				Get
					Dim where As WhereParameter = New WhereParameter(ColumnNames.IdNotaRemision, Parameters.IdNotaRemision)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property NroComprobante() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.NroComprobante, Parameters.NroComprobante)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Fecha() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Fecha, Parameters.Fecha)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdVenta() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdVenta, Parameters.IdVenta)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdCompra() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdCompra, Parameters.IdCompra)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdMotivoStock() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdMotivoStock, Parameters.IdMotivoStock)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property Estado() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.Estado, Parameters.Estado)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property ActualizadoPor() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.ActualizadoPor, Parameters.ActualizadoPor)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property ActualizadoFecha() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.ActualizadoFecha, Parameters.ActualizadoFecha)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdCliente() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdCliente, Parameters.IdCliente)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdProveedor() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdProveedor, Parameters.IdProveedor)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdDepositoOrigen() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdDepositoOrigen, Parameters.IdDepositoOrigen)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property

                Public ReadOnly Property IdDepositoDestino() As WhereParameter
                    Get
                        Dim where As WhereParameter = New WhereParameter(ColumnNames.IdDepositoDestino, Parameters.IdDepositoDestino)
                        Me._clause._entity.Query.AddWhereParameter(where)
                        Return where
                    End Get
                End Property


			Private _clause as WhereClause
		End Class
		#End Region	

		Public ReadOnly Property IdNotaRemision() As WhereParameter 
			Get
				If _IdNotaRemision_W Is Nothing Then
					_IdNotaRemision_W = TearOff.IdNotaRemision
				End If
				Return _IdNotaRemision_W
			End Get
		End Property

		Public ReadOnly Property NroComprobante() As WhereParameter 
			Get
				If _NroComprobante_W Is Nothing Then
					_NroComprobante_W = TearOff.NroComprobante
				End If
				Return _NroComprobante_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As WhereParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property IdVenta() As WhereParameter 
			Get
				If _IdVenta_W Is Nothing Then
					_IdVenta_W = TearOff.IdVenta
				End If
				Return _IdVenta_W
			End Get
		End Property

		Public ReadOnly Property IdCompra() As WhereParameter 
			Get
				If _IdCompra_W Is Nothing Then
					_IdCompra_W = TearOff.IdCompra
				End If
				Return _IdCompra_W
			End Get
		End Property

		Public ReadOnly Property IdMotivoStock() As WhereParameter 
			Get
				If _IdMotivoStock_W Is Nothing Then
					_IdMotivoStock_W = TearOff.IdMotivoStock
				End If
				Return _IdMotivoStock_W
			End Get
		End Property

		Public ReadOnly Property Estado() As WhereParameter 
			Get
				If _Estado_W Is Nothing Then
					_Estado_W = TearOff.Estado
				End If
				Return _Estado_W
			End Get
		End Property

		Public ReadOnly Property ActualizadoPor() As WhereParameter 
			Get
				If _ActualizadoPor_W Is Nothing Then
					_ActualizadoPor_W = TearOff.ActualizadoPor
				End If
				Return _ActualizadoPor_W
			End Get
		End Property

		Public ReadOnly Property ActualizadoFecha() As WhereParameter 
			Get
				If _ActualizadoFecha_W Is Nothing Then
					_ActualizadoFecha_W = TearOff.ActualizadoFecha
				End If
				Return _ActualizadoFecha_W
			End Get
		End Property

		Public ReadOnly Property IdCliente() As WhereParameter 
			Get
				If _IdCliente_W Is Nothing Then
					_IdCliente_W = TearOff.IdCliente
				End If
				Return _IdCliente_W
			End Get
		End Property

		Public ReadOnly Property IdProveedor() As WhereParameter 
			Get
				If _IdProveedor_W Is Nothing Then
					_IdProveedor_W = TearOff.IdProveedor
				End If
				Return _IdProveedor_W
			End Get
		End Property

		Public ReadOnly Property IdDepositoOrigen() As WhereParameter 
			Get
				If _IdDepositoOrigen_W Is Nothing Then
					_IdDepositoOrigen_W = TearOff.IdDepositoOrigen
				End If
				Return _IdDepositoOrigen_W
			End Get
		End Property

		Public ReadOnly Property IdDepositoDestino() As WhereParameter 
			Get
				If _IdDepositoDestino_W Is Nothing Then
					_IdDepositoDestino_W = TearOff.IdDepositoDestino
				End If
				Return _IdDepositoDestino_W
			End Get
		End Property

		Private _IdNotaRemision_W As WhereParameter = Nothing
		Private _NroComprobante_W As WhereParameter = Nothing
		Private _Fecha_W As WhereParameter = Nothing
		Private _IdVenta_W As WhereParameter = Nothing
		Private _IdCompra_W As WhereParameter = Nothing
		Private _IdMotivoStock_W As WhereParameter = Nothing
		Private _Estado_W As WhereParameter = Nothing
		Private _ActualizadoPor_W As WhereParameter = Nothing
		Private _ActualizadoFecha_W As WhereParameter = Nothing
		Private _IdCliente_W As WhereParameter = Nothing
		Private _IdProveedor_W As WhereParameter = Nothing
		Private _IdDepositoOrigen_W As WhereParameter = Nothing
		Private _IdDepositoDestino_W As WhereParameter = Nothing

			Public Sub WhereClauseReset()

			_IdNotaRemision_W = Nothing
			_NroComprobante_W = Nothing
			_Fecha_W = Nothing
			_IdVenta_W = Nothing
			_IdCompra_W = Nothing
			_IdMotivoStock_W = Nothing
			_Estado_W = Nothing
			_ActualizadoPor_W = Nothing
			_ActualizadoFecha_W = Nothing
			_IdCliente_W = Nothing
			_IdProveedor_W = Nothing
			_IdDepositoOrigen_W = Nothing
			_IdDepositoDestino_W = Nothing
				Me._entity.Query.FlushWhereParameters()

			End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffWhereParameter
    End Class	

	Public ReadOnly Property Where() As WhereClause
		Get
			If _whereClause Is Nothing Then
				_whereClause = New WhereClause(Me)
			End If
	
			Return _whereClause
		End Get
	End Property
	
	Private _whereClause As WhereClause = Nothing	
#End Region	

#Region "Aggregate Clause"
    Public Class AggregateClause

        Public Sub New(ByVal entity As BusinessEntity)
            Me._entity = entity
        End Sub
		
		Public ReadOnly Property TearOff As TearOffAggregateParameter
			Get
				If _tearOff Is Nothing Then
					_tearOff = new TearOffAggregateParameter(Me)
				End If

				Return _tearOff
			End Get
		End Property

		#Region "AggregateParameter TearOff's"
		Public class TearOffAggregateParameter

			Public Sub New(ByVal clause As AggregateClause)
				Me._clause = clause
			End Sub
		
	
		Public ReadOnly Property IdNotaRemision() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdNotaRemision, Parameters.IdNotaRemision)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property NroComprobante() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.NroComprobante, Parameters.NroComprobante)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Fecha, Parameters.Fecha)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdVenta() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdVenta, Parameters.IdVenta)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdCompra() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdCompra, Parameters.IdCompra)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdMotivoStock() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdMotivoStock, Parameters.IdMotivoStock)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property Estado() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.Estado, Parameters.Estado)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property ActualizadoPor() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.ActualizadoPor, Parameters.ActualizadoPor)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property ActualizadoFecha() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.ActualizadoFecha, Parameters.ActualizadoFecha)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdCliente() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdCliente, Parameters.IdCliente)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdProveedor() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdProveedor, Parameters.IdProveedor)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdDepositoOrigen() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdDepositoOrigen, Parameters.IdDepositoOrigen)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property

		Public ReadOnly Property IdDepositoDestino() As AggregateParameter
			Get
				Dim where As AggregateParameter = New AggregateParameter(ColumnNames.IdDepositoDestino, Parameters.IdDepositoDestino)
				Me._clause._entity.Query.AddAggregateParameter(where)
				Return where
			End Get
		End Property


			Private _clause as AggregateClause
		End Class
		#End Region	

		Public ReadOnly Property IdNotaRemision() As AggregateParameter 
			Get
				If _IdNotaRemision_W Is Nothing Then
					_IdNotaRemision_W = TearOff.IdNotaRemision
				End If
				Return _IdNotaRemision_W
			End Get
		End Property

		Public ReadOnly Property NroComprobante() As AggregateParameter 
			Get
				If _NroComprobante_W Is Nothing Then
					_NroComprobante_W = TearOff.NroComprobante
				End If
				Return _NroComprobante_W
			End Get
		End Property

		Public ReadOnly Property Fecha() As AggregateParameter 
			Get
				If _Fecha_W Is Nothing Then
					_Fecha_W = TearOff.Fecha
				End If
				Return _Fecha_W
			End Get
		End Property

		Public ReadOnly Property IdVenta() As AggregateParameter 
			Get
				If _IdVenta_W Is Nothing Then
					_IdVenta_W = TearOff.IdVenta
				End If
				Return _IdVenta_W
			End Get
		End Property

		Public ReadOnly Property IdCompra() As AggregateParameter 
			Get
				If _IdCompra_W Is Nothing Then
					_IdCompra_W = TearOff.IdCompra
				End If
				Return _IdCompra_W
			End Get
		End Property

		Public ReadOnly Property IdMotivoStock() As AggregateParameter 
			Get
				If _IdMotivoStock_W Is Nothing Then
					_IdMotivoStock_W = TearOff.IdMotivoStock
				End If
				Return _IdMotivoStock_W
			End Get
		End Property

		Public ReadOnly Property Estado() As AggregateParameter 
			Get
				If _Estado_W Is Nothing Then
					_Estado_W = TearOff.Estado
				End If
				Return _Estado_W
			End Get
		End Property

		Public ReadOnly Property ActualizadoPor() As AggregateParameter 
			Get
				If _ActualizadoPor_W Is Nothing Then
					_ActualizadoPor_W = TearOff.ActualizadoPor
				End If
				Return _ActualizadoPor_W
			End Get
		End Property

		Public ReadOnly Property ActualizadoFecha() As AggregateParameter 
			Get
				If _ActualizadoFecha_W Is Nothing Then
					_ActualizadoFecha_W = TearOff.ActualizadoFecha
				End If
				Return _ActualizadoFecha_W
			End Get
		End Property

		Public ReadOnly Property IdCliente() As AggregateParameter 
			Get
				If _IdCliente_W Is Nothing Then
					_IdCliente_W = TearOff.IdCliente
				End If
				Return _IdCliente_W
			End Get
		End Property

		Public ReadOnly Property IdProveedor() As AggregateParameter 
			Get
				If _IdProveedor_W Is Nothing Then
					_IdProveedor_W = TearOff.IdProveedor
				End If
				Return _IdProveedor_W
			End Get
		End Property

		Public ReadOnly Property IdDepositoOrigen() As AggregateParameter 
			Get
				If _IdDepositoOrigen_W Is Nothing Then
					_IdDepositoOrigen_W = TearOff.IdDepositoOrigen
				End If
				Return _IdDepositoOrigen_W
			End Get
		End Property

		Public ReadOnly Property IdDepositoDestino() As AggregateParameter 
			Get
				If _IdDepositoDestino_W Is Nothing Then
					_IdDepositoDestino_W = TearOff.IdDepositoDestino
				End If
				Return _IdDepositoDestino_W
			End Get
		End Property

		Private _IdNotaRemision_W As AggregateParameter = Nothing
		Private _NroComprobante_W As AggregateParameter = Nothing
		Private _Fecha_W As AggregateParameter = Nothing
		Private _IdVenta_W As AggregateParameter = Nothing
		Private _IdCompra_W As AggregateParameter = Nothing
		Private _IdMotivoStock_W As AggregateParameter = Nothing
		Private _Estado_W As AggregateParameter = Nothing
		Private _ActualizadoPor_W As AggregateParameter = Nothing
		Private _ActualizadoFecha_W As AggregateParameter = Nothing
		Private _IdCliente_W As AggregateParameter = Nothing
		Private _IdProveedor_W As AggregateParameter = Nothing
		Private _IdDepositoOrigen_W As AggregateParameter = Nothing
		Private _IdDepositoDestino_W As AggregateParameter = Nothing

		Public Sub AggregateClauseReset()

		_IdNotaRemision_W = Nothing
		_NroComprobante_W = Nothing
		_Fecha_W = Nothing
		_IdVenta_W = Nothing
		_IdCompra_W = Nothing
		_IdMotivoStock_W = Nothing
		_Estado_W = Nothing
		_ActualizadoPor_W = Nothing
		_ActualizadoFecha_W = Nothing
		_IdCliente_W = Nothing
		_IdProveedor_W = Nothing
		_IdDepositoOrigen_W = Nothing
		_IdDepositoDestino_W = Nothing
			Me._entity.Query.FlushAggregateParameters()

		End Sub
	
		Private _entity As BusinessEntity
		Private _tearOff As TearOffAggregateParameter
    End Class	

	Public ReadOnly Property Aggregate() As AggregateClause
		Get
			If _aggregateClause Is Nothing Then
				_aggregateClause = New AggregateClause(Me)
			End If
	
			Return _aggregateClause
		End Get
	End Property
	
	Private _aggregateClause As AggregateClause = Nothing	
#End Region	

	Protected Overrides Function GetInsertCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_notaRemisionInsert]" 
	    
		CreateParameters(cmd)
		
		Dim p As SqlParameter
		p = cmd.Parameters(Parameters.IdNotaRemision.ParameterName)
		p.Direction = ParameterDirection.Output
    
		Return cmd 

  	End Function
	
	Protected Overrides Function GetUpdateCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_notaRemisionUpdate]" 
		
		CreateParameters(cmd) 
		    
		Return cmd
	
	End Function	
	
	Protected Overrides Function GetDeleteCommand() As IDbCommand
	
		Dim cmd As SqlCommand = New SqlCommand
		cmd.CommandType = CommandType.StoredProcedure    
		cmd.CommandText = "[" + Me.SchemaStoredProcedure + "proc_si_notaRemisionDelete]" 
		
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdNotaRemision)
		p.SourceColumn = ColumnNames.IdNotaRemision
		p.SourceVersion = DataRowVersion.Current

  
		Return cmd
	
	End Function	
	
	Private Sub CreateParameters(ByVal cmd As SqlCommand)
	
		Dim p As SqlParameter
		p = cmd.Parameters.Add(Parameters.IdNotaRemision)
		p.SourceColumn = ColumnNames.IdNotaRemision
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.NroComprobante)
		p.SourceColumn = ColumnNames.NroComprobante
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Fecha)
		p.SourceColumn = ColumnNames.Fecha
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdVenta)
		p.SourceColumn = ColumnNames.IdVenta
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdCompra)
		p.SourceColumn = ColumnNames.IdCompra
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdMotivoStock)
		p.SourceColumn = ColumnNames.IdMotivoStock
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.Estado)
		p.SourceColumn = ColumnNames.Estado
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.ActualizadoPor)
		p.SourceColumn = ColumnNames.ActualizadoPor
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.ActualizadoFecha)
		p.SourceColumn = ColumnNames.ActualizadoFecha
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdCliente)
		p.SourceColumn = ColumnNames.IdCliente
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdProveedor)
		p.SourceColumn = ColumnNames.IdProveedor
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdDepositoOrigen)
		p.SourceColumn = ColumnNames.IdDepositoOrigen
		p.SourceVersion = DataRowVersion.Current

		p = cmd.Parameters.Add(Parameters.IdDepositoDestino)
		p.SourceColumn = ColumnNames.IdDepositoDestino
		p.SourceVersion = DataRowVersion.Current


	End Sub	

End Class

End NameSpace

